<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Spoofchecker class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="resourcebundle.locales.html">« ResourceBundle::getLocales</a></li>
      <li style="float: right;"><a href="spoofchecker.areconfusable.html">Spoofchecker::areConfusable »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.intl.html">intl</a></li>
    <li>The Spoofchecker class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.spoofchecker" class="reference">

 <h1 class="title">The Spoofchecker class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.4.0, PHP 7, PHP 8, PECL intl &gt;= 2.0.0)</p>


  <div class="section" id="spoofchecker.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    This class is provided because Unicode contains large number of characters
    and incorporates the varied writing systems of the world and their incorrect
    usage can expose programs or systems to possible security attacks using
    characters similarity.
   </p>
   <p class="para">
    Provided methods allow to check whether an individual string is likely an attempt
    at confusing the reader (<code class="literal">spoof detection</code>), such as  &quot;pаypаl&quot;
    spelled with Cyrillic &#039;а&#039; characters.
   </p>
  </div>


  <div class="section" id="spoofchecker.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Spoofchecker</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.single-script-confusable"><var class="varname">SINGLE_SCRIPT_CONFUSABLE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.mixed-script-confusable"><var class="varname">MIXED_SCRIPT_CONFUSABLE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.whole-script-confusable"><var class="varname">WHOLE_SCRIPT_CONFUSABLE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.any-case"><var class="varname">ANY_CASE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.single-script"><var class="varname">SINGLE_SCRIPT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.invisible"><var class="varname">INVISIBLE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.char-limit"><var class="varname">CHAR_LIMIT</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.ascii"><var class="varname">ASCII</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.highly-restrictive"><var class="varname">HIGHLY_RESTRICTIVE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.moderately-restrictive"><var class="varname">MODERATELY_RESTRICTIVE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.minimally-restrictive"><var class="varname">MINIMALLY_RESTRICTIVE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.unrestrictive"><var class="varname">UNRESTRICTIVE</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.spoofchecker.html#spoofchecker.constants.single-script-restrictive"><var class="varname">SINGLE_SCRIPT_RESTRICTIVE</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="spoofchecker.construct.html" class="methodname">__construct</a></span>()</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="spoofchecker.areconfusable.html" class="methodname">areConfusable</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string1</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$string2</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$errorCode</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="spoofchecker.issuspicious.html" class="methodname">isSuspicious</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$errorCode</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="spoofchecker.setallowedlocales.html" class="methodname">setAllowedLocales</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$locales</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="spoofchecker.setchecks.html" class="methodname">setChecks</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$checks</code></span>): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>
  

  <div class="section" id="spoofchecker.constants">
   <h2 class="title">预定义常量</h2>
   <dl>
    
     <dt id="spoofchecker.constants.ascii"><strong><code>Spoofchecker::ASCII</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
    
     <dt id="spoofchecker.constants.highly-restrictive"><strong><code>Spoofchecker::HIGHLY_RESTRICTIVE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
    
     <dt id="spoofchecker.constants.moderately-restrictive"><strong><code>Spoofchecker::MODERATELY_RESTRICTIVE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
    
     <dt id="spoofchecker.constants.minimally-restrictive"><strong><code>Spoofchecker::MINIMALLY_RESTRICTIVE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
    
     <dt id="spoofchecker.constants.unrestrictive"><strong><code>Spoofchecker::UNRESTRICTIVE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
    
     <dt id="spoofchecker.constants.single-script-restrictive"><strong><code>Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.single-script-confusable"><strong><code>Spoofchecker::SINGLE_SCRIPT_CONFUSABLE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.mixed-script-confusable"><strong><code>Spoofchecker::MIXED_SCRIPT_CONFUSABLE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.whole-script-confusable"><strong><code>Spoofchecker::WHOLE_SCRIPT_CONFUSABLE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.any-case"><strong><code>Spoofchecker::ANY_CASE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.single-script"><strong><code>Spoofchecker::SINGLE_SCRIPT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.invisible"><strong><code>Spoofchecker::INVISIBLE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="spoofchecker.constants.char-limit"><strong><code>Spoofchecker::CHAR_LIMIT</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

   </dl>

  </div>



  <div class="section">
  <h2 class="title">更新日志</h2>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.3.0</td>
      <td>
       Class constants used by <span class="function"><strong>Spoofchecker::setRestrictionLevel()</strong></span> such as <strong><code>Spoofchecker::ASCII</code></strong>, <strong><code>Spoofchecker::HIGHLY_RESTRICTIVE</code></strong>, <strong><code>Spoofchecker::MODERATELY_RESTRICTIVE</code></strong>, <strong><code>Spoofchecker::MINIMALLY_RESTRICTIVE</code></strong>, <strong><code>Spoofchecker::UNRESTRICTIVE</code></strong>, <strong><code>Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE</code></strong> has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>
  
 </div>

 




























<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="spoofchecker.areconfusable.html">Spoofchecker::areConfusable</a> — Checks if given strings can be confused</li><li><a href="spoofchecker.construct.html">Spoofchecker::__construct</a> — Constructor</li><li><a href="spoofchecker.issuspicious.html">Spoofchecker::isSuspicious</a> — Checks if a given text contains any suspicious characters</li><li><a href="spoofchecker.setallowedlocales.html">Spoofchecker::setAllowedLocales</a> — Locales to use when running checks</li><li><a href="spoofchecker.setchecks.html">Spoofchecker::setChecks</a> — Set the checks to run</li></ul>
</div>
</div></div></body></html>